<?php
class Image
{
    private $CI;

    public $id;
    public $name;
    public $path;

    function __construct($ids) {
        $this->CI =& get_instance();
    }

    public function update() {
        $data = array(
            'name' => $this->name,
            'path' => $this->path
        );

        $this->CI->db->where('id', $this->id);
        $this->CI->db->update(TABLE_IMAGES, $data);

    }

    public function delete() {
        $res = $this->CI->db->delete(TABLE_IMAGES, array('id' => $this->id));
    }

    public function upload() {
        $data = array(
            'name' => $this->name,
            'path' => $this->path
        );

        $this->CI->db->insert(TABLE_IMAGES, $data);
    }

}
?>